﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _14.FindMaxMinAvgProduct
{
    class FindMaxMinAvgProduct
    {
        

        static int Min(ref int[] arrayOfParams)
        {
            int minNumber = arrayOfParams[0];
            
            for (int i = 1; i < arrayOfParams.Length; i++)
            {
                
                    if (arrayOfParams[i] < minNumber)
                    {
                        minNumber = arrayOfParams[i];
                    }
            }
            return minNumber;
        }

        static int Min(params int[] arrayOfParams)
        {
            int minNumber = arrayOfParams[0];

            for (int i = 1; i < arrayOfParams.Length; i++)
            {

                if (arrayOfParams[i] < minNumber)
                {
                    minNumber = arrayOfParams[i];
                }
            }
            return minNumber;
        }
        static decimal Average(params int[] arrayOfParams)
        {
            decimal counts = 0;
            decimal sum = arrayOfParams[0];
            decimal averageOfNumbers = 0;
            for (int i = 1; i < arrayOfParams.Length; i++)
            {
                sum += arrayOfParams[i];
                counts++;
            }
            averageOfNumbers = sum / counts;
            return averageOfNumbers;
        }
        static int Max(params int[] arrayOfParams)
        {
            int maxNumber = arrayOfParams[0];

            for (int i = 1; i < arrayOfParams.Length; i++)
            {
                if (arrayOfParams[i] > maxNumber)
                {
                    maxNumber = arrayOfParams[i];
                }
            }
            return maxNumber;
        }
        static int Max(ref int[] arrayOfParams)
        {
            int maxNumber = arrayOfParams[0];

            for (int i = 1; i < arrayOfParams.Length; i++)
            {
                if (arrayOfParams[i] > maxNumber)
                {
                    maxNumber = arrayOfParams[i];
                }
            }
            return maxNumber;
        }
        static int Sum(params int[] arrayOfParams)
        {
            int sumOfElements = 0;
            for (int i = 1; i < arrayOfParams.Length; i++)
            {
                sumOfElements += arrayOfParams[i];
            }
            return sumOfElements;
        }
        static int Product(params int[] arrayOfParams)
        {
            int product = 1;
            for (int i = 1; i < arrayOfParams.Length; i++)
            {
                product *= arrayOfParams[i];
            }
           
            return product;
        }
        static void Main()
        {
            Console.WriteLine("Length: ");
            int n = int.Parse(Console.ReadLine());
            int[] sequence;
            sequence = new int[n];
            for (int i = 0; i < n; i++)
            {
                Console.Write("sequence[{0}]=",i);
                sequence[i] = int.Parse(Console.ReadLine());
            }
            Console.WriteLine("Min of ref sequence array: {0}", Min(ref sequence));
            Console.WriteLine("Max of ref sequence array : {0}", Max(ref sequence));
            Console.WriteLine("Average of sequence array: {0:0.000}", Average(sequence));
            Console.WriteLine("Sum of sequence array: {0}", Sum(sequence));
            Console.WriteLine("Product of sequence array : {0}", Product(sequence));
            Console.WriteLine();
            Console.WriteLine("Min of params: {0}", Min(5, 6, 21, 3));
            Console.WriteLine("Max of params : {0}", Max(5, 6, 21, 3));
            Console.WriteLine("Average of params : {0:0.000}", Average(5, 6, 21, 3));
            Console.WriteLine("Sum of params: {0}", Sum(5, 6, 21, 3));
            Console.WriteLine("Product of params : {0}", Product(5, 6, 21, 3));
            Console.WriteLine();
        }
    }
}